package com.situ.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import com.situ.service.PyPayService;
import com.situ.entity.PyPay;
import java.util.*;
/**
 * PyPay的路由接口服务
 * 
 * @author 胡文
 *
 */
@Controller
public class PyPayController {

	/** PyPayService服务 */
	@Autowired
	private PyPayService pyPayService;
	
	/**
	 * 查询所有PyPay数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "queryPyPay", produces = {"application/json;charset=UTF-8"})
	public String find(PyPay value,Map map) {
		 List<PyPay> list= pyPayService.find(value);
         map.put("items",list);
         return "页面名称自己改";
	}
	
	/**
	 * 通过id查询PyPay数据的方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "queryPyPayById/{id}", produces = {"application/json;charset=UTF-8"})
	public String findOne(@PathVariable(name="id") String id,Map map) {
        PyPay obj=  pyPayService.findOne(id);
        map.put("PyPay",obj);
        return "页面名称自己改";
	}
	
	/**
	 * 插入PyPay属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "savePyPay", produces = {"application/json;charset=UTF-8"})
	public String save(PyPay value) {
		  pyPayService.saveNotNull(value);
        return "redirect:/queryPyPay";
	}
	
	/**
	 * 更新PyPay属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "updatePyPay", produces = {"application/json;charset=UTF-8"})
	public String update(PyPay value) {
		  pyPayService.updateNotNullById(value);
          return "redirect:/queryPyPay";
	}
	
	/**
	 * 通过id删除PyPay数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "delPyPayById/{id}", produces = {"application/json;charset=UTF-8"})
	public String delete(@PathVariable(name="id") String id) {
		  pyPayService.deleteById(id);
          return "redirect:/queryPyPay";
	}
}
